package com.admin.service;

import com.data.entity.${table.className};
import com.data.mapper.${table.className}Mapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ${table.className}Service  {
    @Resource
    private ${table.className}Mapper ${table.lowerClassName}Mapper;

    public List<${table.className}> listPage(Integer page, Integer limit) {
        if(page>0){
            page=(page-1)*limit;
        }
        return ${table.lowerClassName}Mapper.listPage(page,limit);
    }

    public int count() {
        return ${table.lowerClassName}Mapper.count();
    }

    public ${table.className} getInfo(Long id) {
        return ${table.lowerClassName}Mapper.selectById(id);
    }

    public int add(${table.className} ${table.lowerClassName}) {
        return ${table.lowerClassName}Mapper.insert(${table.lowerClassName});
    }

    public int delete(Long id) {
        return ${table.lowerClassName}Mapper.deleteById(id);
    }

    public int edit(${table.className} ${table.lowerClassName}) {
        return ${table.lowerClassName}Mapper.updateById(${table.lowerClassName});
    }
}
